namespace JHT.SimpleTaskSystem.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class IniteCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Persons",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        UserName = c.String(nullable: false, maxLength: 50, unicode: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.SimpleTasks",
                c => new
                    {
                        TaskId = c.Long(nullable: false, identity: true),
                        FKAssignedPersonId = c.Int(),
                        Description = c.String(),
                        CreationTime = c.DateTime(nullable: false),
                        TaskState = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.TaskId)
                .ForeignKey("dbo.Persons", t => t.FKAssignedPersonId)
                .Index(t => t.FKAssignedPersonId);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.SimpleTasks", "FKAssignedPersonId", "dbo.Persons");
            DropIndex("dbo.SimpleTasks", new[] { "FKAssignedPersonId" });
            DropTable("dbo.SimpleTasks");
            DropTable("dbo.Persons");
        }
    }
}
